//
//  UIView+XMKit.m
//  XMKit
//
//  Created by chenming on 2018/5/29.
//  Copyright © 2018年 ChenXiaoMing. All rights reserved.
//

#import "UIView+XMKit.h"

@implementation UIView (XMKit)

- (UIWindow *)lastWindow {
    NSArray *windows = [UIApplication sharedApplication].windows;
    for(UIWindow *window in [windows reverseObjectEnumerator]) {
        if ([window isKindOfClass:[UIWindow class]] &&
            CGRectEqualToRect(window.bounds, [UIScreen mainScreen].bounds))
            
            return window;
    }
    return [UIApplication sharedApplication].delegate.window;
}

@end
